//
//  UIImageView_Extension.swift
//  swiftProductTemplate
//
//  Created by 刘圣洁 on 2025/6/19.
//

import UIKit

extension UIImageView {
    
    // MARK: - 快捷创建方法
    static func make(
        frame: CGRect? = nil,
        image: UIImage,
        contentMode: UIView.ContentMode = .scaleToFill,
        cornerRadius: CGFloat = 0,
        toView: UIView
    ) -> UIImageView {
        let imageV = UIImageView(image: image)
        if let frame { imageV.frame = frame }
        imageV.contentMode = contentMode
        if cornerRadius != 0 {
            imageV.layer.cornerRadius = cornerRadius
            imageV.layer.masksToBounds = true
        }
        toView.addSubview(imageV)
        return imageV
    }
    
}
